package com.xiaoyu.awakening.deepdoc.config;

import com.baidu.aip.ocr.AipOcr;
import com.xiaoyu.awakening.deepdoc.config.properties.BaiduApiProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * AwkBaiduAPIConfig
 *
 * @author wangxiaoyu
 * @date 2025/3/18 09:35
 * @since v1.0
 */
@Configuration
public class AwkBaiduAPIConfig {

    @Bean
    @ConfigurationProperties(prefix = "baidu.api")
    public BaiduApiProperties ocrProperties() {
        return new BaiduApiProperties();
    }

    @Bean
    public AipOcr aipOcr(@Autowired BaiduApiProperties baiduApiProperties) {
        return new AipOcr(baiduApiProperties.getAppId(), baiduApiProperties.getApiKey(), baiduApiProperties.getSecretKey());
    }

}


